<style>
.style-list{margin-bottom:30px;border:1px solid #efefef;background:rgba(237,237,238,0.6);padding:5px;position:relative;}
.style-list:hover{z-index:20;box-shadow: 0 0 3px rgb(170, 170, 170);}
.style-list:hover .tools{display:block;}
.style-list .content{background:#fefefe;padding:10px;}
.style-list .tools{display:none;text-align:right;position:absolute;bottom:5px;right:0px;width:100%;padding:5px;background:rgba(0,0,0,0.3);color:#FFF;}
.style-list .tools a:hover{text-decoration: none;}
.col-md-4{padding-left:10px;padding-right:10px;}
.btn-favorite{font-size:20px;color:red;}
</style>
<div class="container">	
<div id="my-templates">	
	<div class="alert alert-info"><strong>提示：</strong>选择模板后，模板内容会自动替换编辑器内部的内容。如需要恢复编辑器原有的内容请按“ctrl+z”。</div>
	<ul class="nav nav-tabs">
	{{if $current_user_id}}
	  	{{if $personals}}<li><a href="#personal-tpl-list{{$suffix}}" data-toggle="tab">个人模板</a></li>{{/if}}
	  	{{if $favorites}}<li><a href="#favorite-tpl-list{{$suffix}}" data-toggle="tab">收藏模板</a></li>{{/if}}
	{{/if}}
	  <li><a href="#recommend-tpl-list{{$suffix}}" data-toggle="tab">系统推荐</a></li>
	</ul>


	<div class="tab-content" id="tpl-tab-content">
		{{if $current_user_id}}
			
			<div id="personal-tpl-list{{$suffix}}" class="tab-pane">
				
				{{if $personals}}
				<div class="row">
			    <?PHP foreach($personals as $k => $item) {
				$item = $item['EditorStyle'];
    		?>	
	    		<div class="col-md-3">
					{{template editor_styles/_list}}
				</div>
			    <?php } ?>
			    </div>
			    {{else}}
			    	<p class="alert alert-warning mt10">保存的个人模板会出现在这里,您可以在编辑完后，点击编辑区右侧的保存按钮“<i class="fa fa-save"></i>”来保存个人模板</p>
			    {{/if}}			    
			</div>
			
			
			<div id="favorite-tpl-list{{$suffix}}" class="tab-pane">
				{{if $favorites}}
				<div class="row">
			    <?PHP foreach($favorites as $k => $item) {
				$item = $item['EditorStyle'];
    		?>	
	    			<div class="col-md-3">
					{{template editor_styles/_list}}
					</div>
			    <?php } ?>
			    </div>
			    {{else}}
			    	<p class="alert alert-warning mt10">收藏的模板会出现在这里，<a href="{{$this->Html->url('/template-center?cate_id=3')}}">前往模板中心</a></p>
			    {{/if}}
			</div>
		
		{{/if}}
		<div id="recommend-tpl-list{{$suffix}}" class="row tab-pane">
		    <?PHP 
				$unuse_data_id = true; // 系统推荐的不使用id，
				foreach($recommends as $k => $item) {
					$item = $item['EditorStyle'];				
    		?>	
    			<div class="col-md-3">
				{{template editor_styles/_list}}
				</div>
		    <?php } ?>
		</div>
	</div>
</div>
</div>
<script>
$(function(){
	$('#my-templates .nav-tabs a:first').tab('show');
})
</script>